package top.toptimus.dto.customerInfo;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@NoArgsConstructor
@Data
public class CustomerChooseInfoDTO {
    private String id;
    private String customerId;//客户id
    private String customerName;//客户名称
    private String countId;//客户量体id
    private String mobile;//手机
    private String createDate;//创建时间
    private String customerCountName;//客户量体名称
    private String addressId;//地址id
    private List<CustomerFitRDTO> customerFitRDTOS;//客户量体
    private CustomerOrderCommitDTO customerOrderCommitDTO;//收货信息

    /**
     * 创建空客户
     *
     * @return this
     */
    public CustomerChooseInfoDTO buildEmptyCustomer() {
        this.customerId = "0";
        this.customerName = "";
        this.addressId = "0";
        this.countId = "0";
        return this;
    }

    /**
     * 注入客户的地址信息
     *
     * @param customerOrderCommitDTO 客户地址信息
     * @return this
     */
    public CustomerChooseInfoDTO buildAddress(CustomerOrderCommitDTO customerOrderCommitDTO) {
        this.customerOrderCommitDTO = customerOrderCommitDTO;
        return this;
    }

    /**
     * 注入客户量体信息
     *
     * @param customerFitRDTOS 量体信息
     * @return this
     */
    public CustomerChooseInfoDTO buildCustomerFitRDTOS(List<CustomerFitRDTO> customerFitRDTOS) {
        this.customerFitRDTOS = customerFitRDTOS;
        return this;
    }

    /**
     * 注入客户量体信息
     *
     * @param addressId        地址id
     * @param countId          客户量体id
     * @param customerFitRDTOS 量体信息
     * @return this
     */
    public CustomerChooseInfoDTO build(
            String addressId,
            String countId,
            List<CustomerFitRDTO> customerFitRDTOS
    ) {
        this.addressId = addressId;
        this.countId = countId;
        this.customerFitRDTOS = customerFitRDTOS;
        return this;
    }

    public CustomerChooseInfoDTO(
            Integer customerId,
            String customerName,
            String mobile,
            String createDate
    ) {
        this.customerId = customerId.toString();
        this.customerName = customerName;
        this.mobile = mobile;
        this.createDate = createDate;
    }

    public void buildCustomerAddtionInfo(
            String customerCountName,
            Integer countId
    ) {
        this.customerCountName = customerCountName;
        this.countId = countId.toString();
    }

    public void buildCustomerAddress(
            Integer addressId
    ) {
        this.addressId = addressId.toString();
    }
}
